﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="HeatMapPrototype._Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Heatmap Prototype</title>
    <script src="jquery-1.7.2.js" type="text/javascript"></script>
    <link type="text/css" href="style.css" rel="Stylesheet" />
    <script type="text/javascript">
        jQuery(document).ready(function () {
            $("#special").click(function (e) {
                var xCoordinates = $('#xCoordHF').val();
                var yCoordinates = $('#yCoordHF').val();
                $('#status2').html(e.pageX + ', ' + e.pageY);
                $('#xCoordHF').val(e.pageX);
                $('#yCoordHF').val(e.pageY);
                if (xCoordinates == '' || yCoordinates == '') {
                    $('#xCoordHF').val(xCoordinates += '' + e.pageX.toString() );
                    $('#yCoordHF').val(yCoordinates += '' + e.pageY.toString() );
                }
                else {
                    $('#xCoordHF').val(xCoordinates += ', ' + e.pageX.toString() );
                    $('#yCoordHF').val(yCoordinates += ', ' + e.pageY.toString() );
                }
            });
        })
        
        $(window).unload(function () {
            var xCoordinateString = $('#xCoordHF').val();
            var yCoordinateString = $('#yCoordHF').val();
            $.ajax({
                type: "POST",
                url: "InsertCoordinates.asmx/Insert",
                data: { xCoordinates: xCoordinateString, yCoordinates: yCoordinateString },                
            });

        });
</script>

</head>
<body>
    <form id="special" runat="server">
            <h2 id="status2">
                0, 0
            </h2>
            <div>
                <asp:Button ID="testButton1" runat="server" Text="Button 1" 
                    onclick="testButton1_Click" />
                <asp:Button ID="testButton2" runat="server" Text="Button 2" 
                    onclick="testButton2_Click" />
                <asp:Button ID="testButton3" runat="server" Text="Button 3" 
                    onclick="testButton3_Click" />
                <asp:Button ID="testButton4" runat="server" Text="Button 4" 
                    onclick="testButton4_Click" />
                <asp:Button ID="testButton5" runat="server" Text="Button 5" 
                    onclick="testButton5_Click" />
            </div>            
            <asp:TextBox ID="xCoordHF" runat="server" TextMode="MultiLine"></asp:TextBox>
            <asp:TextBox ID="yCoordHF" runat="server" TextMode="MultiLine"></asp:TextBox>
            <asp:TextBox ID="coordsTextBox" TextMode="MultiLine" runat="server" style="display:none"></asp:TextBox>
    </form>
</body>
</html>
